#-------------------------------------------------------------------------------
# create a deck of cards
# need a list a of suites
# list of all possible product values
# can use ranges in for loops [for i in range ()
# store face values in list and use for loops
#-------------------------------------------------------------------------------
import random
deck = []
suites = ("spades", "hearts", "clovers", "diamonds")
numbers = range(2, 11)
faces = ["jack", "queen","king", "ace"]
fvalues = [11, 12, 13, 14]
values = []
card1 = []
card2 =[]

for x in numbers:
    values.append(str(x))
values.extend(faces)

for y in values:
    for z in suites:
        card = [y,z]
        deck.append(card)

def main():
    card1 = []
    card2 = []
    doit = True
    deck1 = []
    random.shuffle(deck)
    for i in range (0,5):
        h1 = random.choice(deck)
        deck1.append(h1)
        deck.remove(h1)
    deck2 = []
    for i in range (0,5):
        h2 = random.choice(deck)
        deck2.append(h2)
        deck.remove(h2)
    faces = fvalues
    while doit:
        ask = input("Press any key to continue.")
        card1.extend([deck1.pop(0)])
        card2.extend([deck2.pop(0)])
        print(card1)
        print(card2)
        if card1[len(card1)-1][0] > card2[len(card2)-1][0]:
            print("hi")
            deck1.extend(card1)
            deck1.extend(card2)
            card1 = []
            card2 = []
        elif card2[len(card2)-1][0] > card1[len(card1)-1][0]:
            print("hii")
            deck2.extend(card1)
            deck2.extend(card2)
            card1 = []
            card2 = []
        elif card1[len(card1)-1][0] == card2[len(card2)-1][0]:
            print("equal")
        print(len(deck1))
        print(len(deck2))
        if (len(deck1) == 0):
            print("Player 2 wins!")
            doit = False
        elif (len(deck2) == 0):
            print("Player 1 wins!")
            doit = False
    pass

if __name__ == '__main__':
    main()
